import * as http from "@/components/04_https";

/**
 * 第三方插件都是这么实现
 */
export default {
    install(app, options){
        console.log(options);
        //实现全局属性
        app.config.globalProperties.$http = http;
        //实现全局指令
        app.directive('auth' , (el,binding)=>{
            let auths = ['edit', 'delete']
            let ret = auths.includes(binding.value);
            if(!ret){
                el.style.display = 'none'
            }
        });

        //实现全局注册组件
        //需要在vue.config.js配置runtimeCompiler:true,
        app.component('my-component', {
            template: '<div>{{message}}</div>',
            data() {
                return {
                    message: '全局注册组件'
                }
            }
        })
    }
}